/*
 * Copyright (C) 2021 The Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.oushangfeng.pinneddemo.model;

import com.oushangfeng.pinneddemo.ResourceTable;
import com.oushangfeng.pinneddemo.adapter.viewholder.LevelViewHolder;
import com.oushangfeng.pinneddemo.custom.categorylist.SearchItem;
import com.oushangfeng.pinneddemo.util.DensityUtils;
import com.oushangfeng.pinnedsectionitemdecoration.callback.datainterface.Model;

import ohos.app.Context;

/**
 * LevelModel
 *
 * @since 2021-04-19
 */
public class LevelModel implements Model {
    private String name;
    private String singer;
    private Context context;
    private int layout;
    private int imgId;
    private int headType = SearchItem.ITEM_TYPE;

    /**
     * LevelModel
     *
     * @param context
     * @param name
     * @param singer
     */
    public LevelModel(Context context, String name, String singer) {
        this.context = context;
        this.name = name;
        this.singer = singer;
    }

    /**
     * LevelModel
     *
     * @param context
     * @param layout
     * @param name
     * @param singer
     */
    public LevelModel(Context context, int layout, String name, String singer) {
        this.context = context;
        this.layout = layout;
        this.name = name;
        this.singer = singer;
    }

    /**
     * LevelModel
     *
     * @param context
     * @param layout
     * @param name
     * @param imgId
     * @param singer
     */
    public LevelModel(Context context, int layout, String name, int imgId, String singer) {
        this.context = context;
        this.layout = layout;
        this.imgId = imgId;
        this.name = name;
        this.singer = singer;
    }

    /**
     * LevelModel
     *
     * @param name
     * @param headType
     */
    public LevelModel(String name, int headType) {
        this.name = name;
        this.headType = headType;
    }

    public int getImgId() {
        return imgId;
    }

    public void setImgId(int imgId) {
        this.imgId = imgId;
    }

    public int getLayout() {
        return layout;
    }

    public void setLayout(int layout) {
        this.layout = layout;
    }

    public String getName() {
        return name;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSinger() {
        return singer;
    }

    public void setSinger(String singer) {
        this.singer = singer;
    }

    @Override
    public int getResource(int position) {
        return ResourceTable.Layout_song_item;
    }

    @Override
    public Class getHolderClass(int position) {
        return LevelViewHolder.class;
    }

    @Override
    public String getItemValue() {
        return name;
    }

    @Override
    public int getItemType() {
        return headType;
    }

    @Override
    public void setItemValue(String value) {
        name = value;
    }

    @Override
    public String getTypeName() {
        return singer;
    }

    /**
     * width
     *
     * @return DensityUtils
     */
    public int width() {
        return DensityUtils.getDisplayWidth(context);
    }
}
